import 'package:flutter/material.dart';
import 'package:riki_base_flutter/riki_base_flutter.dart';
import 'package:riki_login/res/colors.dart';
import 'package:riki_login/router/riki_login_router.dart';


///作者：范玉辉
///创建时间：2021/2/8
///说明：
Row buildRowText(String text) {
  return Row(
    children: [
      Text(
        text,
        style: TextStyle(
          fontSize: 30.sp,
          fontWeight: FontWeight.bold,
          color: RikiLoginColors.text_333333,
        ),
      ),
    ],
  );
}

class BuildRegisterWidget extends StatefulWidget {
  final Function(bool) listener; // 返回选择值确认订单所需的值
  BuildRegisterWidget({required this.listener});

  @override
  _BuildRegisterWidgetState createState() => _BuildRegisterWidgetState();
}

class _BuildRegisterWidgetState extends State<BuildRegisterWidget> {
  @override
  Widget build(BuildContext context) {
    double width = 124.w;
    return Container(
      child: Row(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          GestureDetector(
            onTap: () => NavigatorUtils.push(context, RikiLoginRouter.staffRegisterWorkerPage).then((value) {
              if (value != null) {
                widget.listener(value);
              }
            }),
            child: Container(
              width: width,
              alignment: Alignment.center,
              height: 58.w,
              child: Text(
                '注册施工工人',
                style: _textMediumStyle,
              ),
            ),
          ),
          Container(
            height: 16.w,
            width: 0.5.w,
            color: RikiLoginColors.color_EEEEEE,
          ),
          GestureDetector(
            onTap: () => NavigatorUtils.push(context, RikiLoginRouter.staffRegisterHouseKeeperPage).then((value) {
              if (value != null) {
                widget.listener(value);
              }
            }),
            child: Container(
              alignment: Alignment.center,
              width: width,
              height: 58.w,
              child: Text(
                '注册施工管家',
                style: _textMediumStyle,
              ),
            ),
          ),
          Container(
            height: 16.w,
            width: 0.5.w,
            color: RikiLoginColors.color_EEEEEE,
          ),
          GestureDetector(
            onTap: () {
              showDialog(
                context: context,
                barrierDismissible: false,
                builder: (BuildContext context) {
                  return WillPopScope(
                    onWillPop: () => Future.value(false),
                    child: BaseDialog(
                      onlySureType: true,
                      title: '请至应用市场下载“打扮家” app，在“我的”页面申请入驻成为平台云设计师”',
                      determine: '我知道了',
                      onPressed: () {
                        NavigatorUtils.goBack(context);
                      },
                    ),
                  );
                },
              );

              ///设计师申请入口移至用户APP
              // NavigatorUtils.push(context, AppRouter.registerDesignPage).then((value) {
              //   if (value != null) {
              //     widget.listener(value);
              //   }
              // });
            },
            child: Container(
              width: width,
              alignment: Alignment.center,
              height: 58.w,
              child: Text(
                '申请平台设计师',
                style: _textMediumStyle,
              ),
            ),
          ),
        ],
      ),
    );
  }

  TextStyle _textMediumStyle = TextStyle(color: RikiLoginColors.app_main, fontSize: 14.sp, fontWeight: FontWeightExt.medium);
}
